﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace PhanMemDao
{
    public class DiemDao
    {
        DataAccess da = new DataAccess();
        public DataTable danh_sach_diem()
        {
            DataTable dt = new DataTable();
            string sql = " Select ma_diem,so_diem,convert(nvarchar,ngay_lam,103) as ngay_lam,ten_nguoi_dung,ten_bhct from diem,bai_hoc_ct where diem.ma_bhct=bai_hoc_ct.ma_bhct";
            sql += " order by ngay_lam";
            dt = da.lay_du_lieu(sql);
            return dt;
        }
        public DataTable danh_sach_diem_dk(string dieukien)
        {
            DataTable dt = new DataTable();
            string sql = " Select ma_diem,so_diem,convert(nvarchar,ngay_lam,103) as ngay_lam,ten_nguoi_dung,ten_bhct from diem,bai_hoc_ct where diem.ma_bhct=bai_hoc_ct.ma_bhct";
            if (dieukien != "")
                sql += " and " + dieukien;
            sql += " order by ngay_lam";
            dt = da.lay_du_lieu(sql);
            return dt;
        }
        public void xoa_diem(int madiem)
        {
            string sql = "delete diem where ma_diem='" + madiem + "'";
            da.thao_tac_du_lieu(sql);
        }
    }
}
